<template>
	<tm-app ref="app">
		<view class="container">

			<div class="main">
				<div class="cut-box">
					<img :src="CutImg" style="width: 100%" />
				</div>
			</div>

			<div v-if="showTips" class="share-box" @click="showTips = false">
				<div><img :src="YdImg" style="width: 100%" /></div>
				<div class="imgbox">
					<img :src="ShareImg" style="width: 100%" />
				</div>
			</div>
			<div v-else class="btn-box">
				<img :src="BtnImg" id="btnBox" ref="btnRef" @click.stop="downloadXin()" style="width: 100%;" />

			</div>
		</view>
	</tm-app>
</template>

<script setup lang="ts">
	import { ref } from 'vue';
	import { onLoad } from '@dcloudio/uni-app';
	import BtnImg from '@/static/btn.png';
	import CutImg from '@/static/1229/cut.png';
	import ShareImg from '@/static/1229/share.png';
	import YdImg from '@/static/1229/yd.png';

	const inviterId = ref('');
	const activityId = ref('')

	const showTips = ref(false);


	const downloadXin = () => {
		console.log(uni.getSystemInfoSync().platform);
		if (uni.getSystemInfoSync().platform == "ios") {
			console.log(uni.getSystemInfoSync().platform);
			window.location.href = "https://www.pgyer.com/jbLSzV";
			return
		}
		const data = OpenInstall.parseUrlParams();///openinstall.js中提供的api，解析当前网页url中的查询参数并对data进行赋值
		new OpenInstall({//初始化方法，与openinstall服务器交互，应尽早调用
			appKey: "w27skb",//appKey为openinstall为应用分配的唯一id（必须传入）
			onready: function () {//初始化成功回调方法。当初始化完成后，会自动进入
				this.schemeWakeup();//尝试使用scheme打开App（主要用于Android以及iOS的QQ环境中）
				this.wakeupOrInstall();
			}
		}, data);//初始化时传入data，作为一键拉起/App传参安装时候的参数

	}


	const btnRef = ref(null);


	onLoad((options) => {
		inviterId.value = options?.inviterId;
		activityId.value = options?.activityId;
	});
</script>

<style scoped>
	.main {
		position: absolute;
		width: 100%;
		background-image: url(@/static/1229/bg.png);
		background-size: 100% 100%;
		height: 100vh;
		overflow: hidden;
		background-repeat: no-repeat;
		display: flex;
		justify-content: center;
	}

	.cut-box {
		position: absolute;
		width: 80%;
		bottom: -10rpx;
	}

	.share-box {
		z-index: 1000;
		height: 100vh;
		overflow: hidden;
		width: 100%;
		text-align: center;
		position: absolute;
		overflow: hidden;
		background-color: rgba(0, 0, 0, 0.8);
	}

	.share-box .imgbox {
		position: absolute;
		bottom: -40rpx;
		padding-left: 13.5%;
		margin: 0 auto;
		width: 73%;
	}

	.btn-box {
		z-index: 2000;
		width: 40%;
		margin-left: 30%;
		position: absolute;
		bottom: 250rpx;
	}

	.btn-box button {
		width: 300rpx;
		padding: 0 24rpx;
		border-radius: 100rpx;
		color: #ffffff;
		border: none;
		background-color: darkorange;
	}
</style>